#include <string.h>
#include <openssl/sha.h>
#include <openssl/evp.h>
#include <openssl/crypto.h>


int main (void)
{
	EVP_MD_CTX evp;	
	char msg[] = "little test";
	unsigned char tmp[SHA512_DIGEST_LENGTH];

	memset (tmp, 0, SHA512_DIGEST_LENGTH);

	/* Initialisation */
	EVP_MD_CTX_init (&evp);
	EVP_DigestInit_ex (&evp, EVP_sha256 (), NULL);
	
	/* Send the message to the hash function */
	EVP_DigestUpdate (&evp, msg, strlen (msg));
	
	/* got the result in variable result */
	EVP_DigestFinal_ex (&evp, tmp, NULL);
	
	/* Cleaning */
	EVP_MD_CTX_cleanup (&evp);
	
	return (0);
}
